package com.example.backblog.controller.front;

import com.example.backblog.util.COSClientUtil;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
public class FileUploadController {
    /**
     * 腾讯云COS上传
     *
     * @param file
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/cosUpload")
    public ResponseEntity cosUpload(MultipartFile file) throws Exception {
        String filePath = COSClientUtil.upload(file);
        return ResponseEntity.ok(filePath);
    }
}
